<!doctype html>
<html>
<head>
    <title>订单列表页面</title>
    <?php $this->load->module('admin/index/page_header');?>
    <link href="<?php echo URLPRE;?>static/admin/css/font_icon.css" rel="stylesheet" />
    <script type="text/javascript" src="<?php echo URLPRE;?>static/public/Lib/Kalendajs/build/kalendae.standalone.js"></script>
    <link href="<?php echo URLPRE;?>static/public/Lib/Kalendajs/build/kalendae.css" rel="stylesheet" />
</head>
<body>
<div class="wrap J_check_wrap">
    <div class="nav">
        <ul>
            <li class="current"><a  href="javascript:;">酒店订单</a></li>
            <li><a href="<?php echo $add_url;?>">添加订单</a></li>
        </ul>
    </div>
    <form method="post" action="">
        <div class="table_list" id="content">
            <div class="h_a">高级搜索</div>
            <table width="100%" class="table-search-wrap">
                <tbody>
                <tr>
                    <td>
                        订单编号：<input type="text" value="<?php echo $condition['order_sn']?>" placeholder="订单编号" name="order_sn" class="input rounded"   />&nbsp;&nbsp;
                        联系人/电话：<input type="text" value="<?php echo $condition['contact']?>" placeholder="联系人姓名/电话" name="contact" class="input rounded"   />&nbsp;&nbsp;
                        订单状态：<select name="order_status" class="select rounded">
                            <option value="0" <?php if(!$condition['order_status'])echo 'selected';?>>全部</option>
                            <option value="1" <?php if($condition['order_status'] == 1)echo 'selected';?>>未审核</option>
                            <option value="2" <?php if($condition['order_status'] == 2)echo 'selected';?>>已审核</option>
                            <option value="3" <?php if($condition['order_status'] == 3)echo 'selected';?>>已取消</option>
                            <option value="4" <?php if($condition['order_status'] == 4)echo 'selected';?>>已确认</option>
                            <option value="5" <?php if($condition['order_status'] == 5)echo 'selected';?>>已入住</option>
                            <option value="6" <?php if($condition['order_status'] == 6)echo 'selected';?>>已完成</option>
                        </select>
                        &nbsp;&nbsp;
                        &nbsp;&nbsp;<input type="submit" class="btn" value="搜索">

                    </td>
                </tr>
                </tbody>
            </table>
            <table width="100%" >

                <tr>
                    <td>ID</td>
                    <td width="25%">房间号</td>
                    <td>人数</td>
                    <td>联系信息</td>
                    <td>入住/离店</td>
                   <!-- <td>订单金额</td>-->
                    <td>订单状态</td>
                    <td>下单时间</td>
                     <td>操作</td>
                </tr>
                <?php if($list):?>
                    <tbody>
                    <?php foreach($list as $val):?>
                        <tr>
                            <td>
                                <div class="mb5">
                                    <span class="mr15"><?php echo $val['order_id'];?></span>
                                </div>
                            </td>
                            <td>
                                <div class="mb5">
                                    <span class="mr15 text-ellipsis"><?php echo $val['rstr'];?></span><br />
                                    <!--<span class="mr15"><?php /*echo $val['rdate'];*/?></span>-->
                                </div>
                            </td>
                            <td>
                                <div class="mb5">
                                    <span class="mr15"><?php echo $val['number'];?></span>
                                </div>
                            </td>
                            <td>
                                <div class="mb5">
                                    <span class="mr15">联系人：<?php echo $val['contact_name'];?></span><br />
                                   <!-- <span class="mr15">微信昵称：<?php /*echo $val['wx_nick'];*/?></span><br />-->
                                    <span class="mr15">手机号码：<?php echo $val['phone_num'];?></span><br />
                                </div>
                            </td>
                            <td>
                                <div class="mb5">
                                    <span class="mr15">入住：<?php echo fdate($val['start_date']);?></span><br />
                                    <span class="mr15">离店：<?php echo fdate($val['end_date']);?></span><br />
                                </div>
                            </td>

                          <!--  <td>
                                <div class="mb5">
                                    <span class="mr15">总额：<?php /*echo price_format($val['order_account']);*/?></span><br />
                                    <span class="mr15">定金：<?php /*echo price_format($val['earnest_account']);*/?></span><br />
                                    <span class="mr15">已付定金：<?php /*echo price_format($val['earnest_paid_account']);*/?></span><br />
                                    <span class="mr15">未支付：<?php /*echo price_format($val['order_account']-$val['paid_account']);*/?></span><br />
                                </div>
                            </td>-->
                            <td>
                                <div class="mb5">

                                <span class="mr15"><?php echo $val['order_status_name'];?></span><br />
                                <span class="mr15"><?php echo $val['pay_status_name'];?></span><br />
                                </div>
                            </td>
                            <td>
                                <div class="mb5">
                            <span class="mr15">
                                <?php echo fdate($val['add_time']);?>
                            </span><br />

                            <span class="mr15">
                                <?php echo ftime($val['add_time']);?>
                            </span><br />


                                <span class="mr15"><?php if ($val['cat_type'] == 1): ?>
                                        <span
                                            class="red">门市订单</span>
                                    <?php else: ?>
                                        <span
                                            class="green">游客订单</span><?php endif; ?></span><br />
                                </div>
                            </td>
                             <td class="btn_min">
                                    <div class="menu_select">
                                        <ul>
                                            <?php if(isset($val['edit_url'])):?>
                                                <li><a class="icon-pencil" href="<?php echo $val['edit_url'];?>"> <?php echo $val['edit_url_title'];?></a></li>
                                            <?php endif;?>
                                        <?php if(ISSUPERADMIN === true):?>
                                             <li><a class="icon-remove-2 doDel" href="javascript:;" data-uri="<?php echo $val['delete_url'];?>"> 删除</a></li>
                                        <?php endif;?>
<!--                                            --><?php //if(isset($val['check_url'])):?>
<!--                                                <li><a class="icon-paypal-2 operation" href="javascript:;"  title="审核" data-uri="--><?php //echo $val['check_url'];?><!--"> 审核</a></li>-->
<!--                                            --><?php //endif;?>
<!---->
<!--                                            --><?php //if(isset($val['pay_url'])):?>
<!--                                                <li><a class="icon-paypal-2 operation" href="javascript:;"  title="收款" data-uri="--><?php //echo $val['pay_url'];?><!--"> 收款</a></li>-->
<!--                                            --><?php //endif;?>
<!---->
<!--                                            --><?php //if(isset($val['into_url'])):?>
<!--                                                <li><a class="icon-paypal-2 operation" href="javascript:;"  title="入住" data-uri="--><?php //echo $val['into_url'];?><!--"> 已入住</a></li>-->
<!--                                            --><?php //endif;?>
<!---->
<!--                                            -->
<!--                                            --><?php //if(isset($val['cancel_url'])):?>
<!--                                                <li><a class="icon-remove operation" href="javascript:;" data-uri="--><?php //echo $val['cancel_url'];?><!--" title="取消"> 取消</a></li>-->
<!--                                            --><?php //endif;?>
<!---->
<!--                                            --><?php //if(isset($val['finish_url'])):?>
<!--                                                <li><a class="icon-switch operation" href="javascript:;" data-uri="--><?php //echo $val['finish_url'];?><!--" title="完成"> 完成</a></li>-->
<!--                                            --><?php //endif;?>
                                        </ul>
                                    </div>

                            </td>
                        </tr>
                    <?php endforeach;?>
                    </tbody>
                <?php endif;?>
            </table>
        </div>
    </form>
    <div class="page_nav">
        <?php echo $this->mypageclass->show(2); ?>
    </div>
</div>
<script type="text/javascript">
    $(function(){
        //操作订单状态
        $(".operation").click(function(){
            var data_uri = $(this).attr('data-uri');
            var that = $(this, window.top.document);
            var title = $(this).attr('title');
            $.dialog.load(data_uri,{
                title:title+'订单',
                padding:'',
                resize: false,
                drag: false,
                width:'40%',
                fixed: true,
                zIndex:'100'
            });
        });

        //切换
        $('.pointer_nopic').on('click', function() {
            var url = $(this).closest('table').attr("data-uri");

            var s_val  = ($(this).attr('data-value'))== 0 ? 1 : 0 ;
            var s_name = $(this).attr('data-field');
            var s_id   = $(this).attr('data-id');
            $.ajax({
                url:url,
                cache:false,
                dataType:"json",
                data: {id:s_id, field:s_name, val:s_val},
                type:"POST",
                beforeSend:function(){
                    $("#J_ajax_loading").stop().removeClass('ajax_error').addClass('ajax_loading').html("提交请求中，请稍候...").show();
                },
                error:function(){
                    $("#J_ajax_loading").addClass('ajax_error').html("AJAX请求发生错误!").show().fadeOut(5000);
                },
                success:function(msgObj){

                    if(msgObj.status == '1'){
                        $('.msg_status_'+s_id).empty().html('已发送');
                    }
                    $.dialog({
                        style:'tip',
                        width:200,
                        closeTime:100,
                        content: '<p style="text-align: center;color: #336699!important;">发送成功</p>'
                    }).open();

                }
            });
        });
    })
</script>
</body>
</html>